package br.ufg.inf.espweb.sgca.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Type;
import org.joda.time.LocalDateTime;

/**
 *
 * @author diCastro
 */
@Entity
public class Usuario extends Entidade{
    @Getter
    @Setter
    @Column(nullable = false, unique = true)
    private String username;
    @Getter
    @Setter
    private String senha;
    @Getter
    @Setter
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTimeAsString")
    private LocalDateTime ultimoLogin;
    @Getter
    @Setter
    @OneToOne
    @JoinColumn(nullable = false)
    @ForeignKey(name = "fk_usuario_has_pessoa")
    private Pessoa pessoa;
}
